<template>
	<view  class="u-page">
		<u--form labelPosition='left' labelWidth='170rpx' :model="formState" name="basic" >
		<u-form-item label="是否合格" name="Result" :required="true" borderBottom>
			<!-- <u--input v-model="formState.Task" border="none"/> -->
			
			<u-radio-group v-model="formState.Result">
						<u-radio
							:customStyle="{marginRight: '16px'}"
					
							label="合格"
							name="合格"
						>
						</u-radio>
						<u-radio
							:customStyle="{marginRight: '16px'}"
											
							label="不合格"
							name="不合格"
						>
						</u-radio>
					</u-radio-group>
		</u-form-item>
		<u-form-item label="存在问题" :required="true" name="Tag" borderBottom>

			<u--input v-model="formState.Tag" border="none"/>
		</u-form-item>
<!-- 		<u-form-item label="描述" :required="true" name="TestResult"
			:rules="[{ required: true, message: '请输入值' }]" borderBottom>
			<u--input allow-half v-model="formState.TestResult" :min="0"  border="none"/>
		</u-form-item> -->
		<u-form-item
			label="备注"
			prop="Remark"
			borderBottom
			ref="item3"
		>
			<u--textarea
				placeholder="备注"
				v-model="formState.Remark"
				count
			></u--textarea>
		</u-form-item>
		<u-form-item label="今日不开工" :required="true" name="NotWorkDay" borderBottom>
			<u-switch v-model="formState.NotWorkDay" border="none"/></u-switch>
		</u-form-item>
		</u--form>
		<u-button type="primary" text="保存" @click="save"></u-button>
		<u-notify ref="uNotify"></u-notify>
	</view>
</template>

<script>
	import {
		addbuildsafecheck,
	} from '@/common/api.js'
	export default {
		data() {
			return {
				formState:{},
				buildid:'',
				targetdate:"",
				radiolist1:['未带安全帽',''],
				notifyData: {
					message: '保存成功',
					type: 'success',
					color: '#ffffff',
					bgColor: '',
					fontSize: 15,
					duration: 3000,
					safeAreaInsetTop: false
				},
			}
		},
		onLoad(option) {
			this.buildid=option.buildid
			this.targetdate = option.targetdate
		
		},
		methods: {
			save()
			{
				this.formState.BuildId=this.buildid
				this.formState.TargetDate=this.targetdate
				addbuildsafecheck(this.formState).then(res=>{
					uni.setStorageSync("changed","1")
					this.$refs.uNotify.show(this.notifyData)
					uni.navigateBack({delta: 1})
				})
				
				// uni.navigateTo({
				// 	url: "builddailylist?buildid="+this.buildid
				// })
			},
		}
	}
</script>

<style>

</style>
